package com.mcxx.modules.miniSalvation.order.service.read;

import com.mcxx.modules.base.utils.QueryParamUtil;
import com.mcxx.modules.filemanage.easypoi.util.ExportExcelService;
import com.mcxx.modules.filemanage.file.service.FileService;
import com.mcxx.modules.miniSalvation.family.dto.SalvationObjectDTO;
import com.mcxx.modules.miniSalvation.order.dao.read.OrderCareLinkReadDao;
import com.mcxx.modules.miniSalvation.order.dto.OrderCareLinkDTO;
import com.mcxx.modules.miniSalvation.order.entity.OrderCareLinkEntity;
import com.mcxx.modules.miniSalvation.order.param.CareLinkParam;
import com.mcxx.modules.miniSalvation.order.param.CaregiverParam;
import com.mcxx.modules.system.entity.TaskExportEntity;
import com.mcxx.modules.system.service.write.TaskExportWriteService;
import com.mcxx.modules.temporary.fundpay.dto.TmpFundPayFamilyDTO;
import com.mcxx.modules.temporary.fundpay.param.TmpFundPayParam;
import com.mcxx.util.Constant;
import com.mcxx.util.DateUtil;
import com.yinhai.ta404.component.audit.vo.ExcelInfo;
import com.yinhai.ta404.core.restservice.requestbean.PageParam;
import com.yinhai.ta404.core.restservice.resultbean.Page;
import com.yinhai.ta404.core.security.vo.UserAccountVo;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Date;
import java.util.List;

@Service
@TaTransactional(readOnly = true)
public class OrderCareLinkReadService {

    @Autowired
    private OrderCareLinkReadDao orderCareLinkReadDao;

    
    public List<OrderCareLinkEntity> listAll() {
    	return orderCareLinkReadDao.listAll();
    }


    
    public OrderCareLinkEntity getById(String id) {
    	return orderCareLinkReadDao.getById(id);
    }

    
    public OrderCareLinkEntity getCareIdByIdCard(String idCard) {
        return orderCareLinkReadDao.getCareIdByIdCard(idCard);
    }

    
    public Page listByCondition(CareLinkParam param, PageParam pageParam, UserAccountVo accountVo) {

        QueryParamUtil.setBaseParamValue(param,accountVo);
        //param.setSendMonth(DateUtil.getMonthString());


        orderCareLinkReadDao.beginPager(pageParam);
        List<OrderCareLinkDTO> list = orderCareLinkReadDao.listByCondition(param);


        return orderCareLinkReadDao.endPager(list);
    }


    
    public Page listCaregiver(CaregiverParam param, PageParam pageParam, UserAccountVo accountVo) {

        QueryParamUtil.setBaseParamValue(param,accountVo);
        if(StringUtils.isEmpty(param.getSendMonth())){
            param.setSendMonth(DateUtil.getMonthString());
        }


        orderCareLinkReadDao.beginPager(pageParam);
        List<SalvationObjectDTO> list = orderCareLinkReadDao.listCaregiver(param);


        return orderCareLinkReadDao.endPager(list);
    }
}
